<?php
final class Slog_User
{
	static public function login($login, $email, $rol)
	{
		Slog::session()->user = array(
			'login'	=> $login,
			'email'	=> $email,
			'rol'	=> $rol,
		);
	}
	
	static public function logout()
	{
		Slog::session()->user = null;
	}
	
	static public function logged()
	{
		return Slog::session()->user !== null;
	}
	
	static public function isRol($rol)
	{
		$roles = is_array($rol) ? $rol : array($rol);
		return (is_array(Slog::session()->user) && in_array(Slog::session()->user['rol'], $roles));
	}
}